﻿Imports System.IO

Public Class organisations
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Try

            Using sr As New StreamReader(Me.MapPath("organisations.txt"))

                Dim ligne As String
                Dim hEntrees As New Hashtable

                Do
                    ligne = sr.ReadLine

                    If Not (ligne Is Nothing) Then

                        Dim ligneSplitted As String()

                        ligneSplitted = ligne.Split(";")

                        Dim valeur As String = ligneSplitted(0)
                        Dim texte As String = ligneSplitted(1)

                        hEntrees.Add(valeur, texte)

                    End If

                Loop Until ligne Is Nothing



                For Each entree As DictionaryEntry In hEntrees
                    Dim entreeItem As New ListItem
                    entreeItem.Value = entree.Key
                    entreeItem.Text = entree.Value
                    ddlEntree.Items.Add(entreeItem)
                Next

            End Using

        Catch ex As Exception
            lError.Text = "Le Fichier est introuvable"
        End Try


    End Sub

End Class